<template>
    <div v-for="(item, index) in data" :key="index">
        <input type="text" :ref="inputRef" />
        <span @click="handleFocus(index)">focus</span>
    </div>
</template>
  
<script >
import { ref } from "vue";

export default {
    name:'testInput',
    setup() {
        const data = [1, 2, 3, 4, 5];
        const refArr = ref([]);
        const inputRef = (el) => {
            refArr.value.push(el);
        };

        const handleFocus = (index) => {
            refArr.value[index].focus();
            console.log("hhdhdhhdhd");
        };

        return {
            data,
            inputRef,
            handleFocus
        }
    }
}


</script>